<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>递归</title>
</head>
<body>
<script>
    //函数调用自己
    function add(n){
        if(n==1){
            return 1;
        }else{
            return n+add(n-1)
        }
    }
    console.log(add(100));
</script>

</body>
</html>